From 2cc329da2670f6326b3702c5aa65255c084b8025 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 23 Aug 2006 18:35:21 +0100 Subject: [PATCH] [TOOLS] Cleanups to domU ELF loader. - Remove debugging statements. - Cope better with archtectures where neither ELF notes or __xen_guest are needed or required. Signed-off-by: Ian Campbell --- tools/libxc/xc_load_bin.c | 2 +- tools/libxc/xc_load_elf.c | 26 ++++++++++---------------- tools/libxc/xg_private.h | 2 +- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/tools/libxc/xc_load_bin.c b/tools/libxc/xc_load_bin.c index 633d07f7d5..5544ca899d 100644 --- a/tools/libxc/xc_load_bin.c +++ b/tools/libxc/xc_load_bin.c @@ -227,7 +227,7 @@ static int parsebinimage(const char *image, dsi->v_kernstart = dsi->v_start; dsi->v_kernend = dsi->v_end; dsi->v_kernentry = image_info->entry_addr; - dsi->__xen_guest_string = ""; + dsi->__xen_guest_string = NULL; return 0; } diff --git a/tools/libxc/xc_load_elf.c b/tools/libxc/xc_load_elf.c index 70c7c8e815..9964a0dbb4 100644 --- a/tools/libxc/xc_load_elf.c +++ b/tools/libxc/xc_load_elf.c @@ -109,15 +109,13 @@ static const char *xen_guest_string(struct domain_setup_info *dsi, int type) { const char *p = xen_guest_lookup(dsi, type); - DPRINTF("found __xen_guest entry for type %#x = \"%s\"\n", - type, p); - /* * We special case this since the __xen_guest_section treats the * mere precense of the BSD_SYMTAB string as true or false. */ if ( type == XEN_ELFNOTE_BSD_SYMTAB ) return p ? "yes" : "no"; + return p; } @@ -141,9 +139,6 @@ static unsigned long long xen_guest_numeric(struct domain_setup_info *dsi, if (type == XEN_ELFNOTE_HYPERCALL_PAGE) value = dsi->v_start + (value<__elfnote_section ) + return NULL; + for ( note = (Elf_Note *)dsi->__elfnote_section; note < (Elf_Note *)dsi->__elfnote_section_end; note = ELFNOTE_NEXT(note) ) @@ -188,7 +186,6 @@ static Elf_Note *xen_elfnote_lookup(struct domain_setup_info *dsi, int type) return note; } - DPRINTF("unable to find Xen ELF note with type %#x\n", type); return NULL; } @@ -203,9 +200,6 @@ const char *xen_elfnote_string(struct domain_setup_info *dsi, int type) if ( note == NULL ) return NULL; - DPRINTF("found Xen ELF note type %#x = \"%s\"\n", - type, (char *)ELFNOTE_DESC(note)); - return (const char *)ELFNOTE_DESC(note); } @@ -297,7 +291,6 @@ static int parseelfimage(const char *image, shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize)); if ( !is_xen_elfnote_section(image, shdr) ) continue; - DPRINTF("found note section containing Xen entries\n"); dsi->__elfnote_section = (void *)image + shdr->sh_offset; dsi->__elfnote_section_end = (void *)image + shdr->sh_offset + shdr->sh_size; @@ -312,7 +305,6 @@ static int parseelfimage(const char *image, shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize)); if ( is_xen_guest_section(shdr, shstrtab) ) { - DPRINTF("found a legacy __xen_guest section\n"); dsi->__xen_guest_string = (char *)image + shdr->sh_offset; break; } @@ -343,16 +335,18 @@ static int parseelfimage(const char *image, } else { -#ifdef __ia64__ - dsi->__elfnote_section = NULL; - dsi->__xen_guest_string = ""; -#else +#if defined(__x86_64__) || defined(__i386__) ERROR("Not a Xen-ELF image: " "No ELF notes or '__xen_guest' section found."); return -EINVAL; #endif } + /* + * If we have ELF notes then PAE=yes implies that we must support + * the extended cr3 syntax. Otherwise we need to find the + * [extended-cr3] syntax in the __xen_guest string. + */ dsi->pae_kernel = PAEKERN_no; if ( dsi->__elfnote_section ) { diff --git a/tools/libxc/xg_private.h b/tools/libxc/xg_private.h index 11b9cc5290..fcf8d25c7a 100644 --- a/tools/libxc/xg_private.h +++ b/tools/libxc/xg_private.h @@ -159,7 +159,7 @@ struct domain_setup_info * pickup the correct one and retain backwards compatibility. */ void *__elfnote_section, *__elfnote_section_end; - char *__xen_guest_string; + const char *__xen_guest_string; }; typedef int (*parseimagefunc)(const char *image, unsigned long image_size, -- 2.30.2